package com.springcloud.sc.ucpv5.client.commondata.data;

import com.springcloud.sc.ucpv5.client.commondata.datachange.DataExChange;
import com.google.protobuf.Message;

/**
 * Generated from IDL struct "MsgHeader".
 *
 * @author JacORB IDL compiler V 2.3-beta-2, 14-Oct-2006
 * @version generated at 2014-10-29 11:48:54
 */

public final class MsgHeader extends DataExChange {
    public MsgHeader() {
    }

    public int SessionID;
    public int TranceID;
    public int ModuleID;
    public int CmdID;
    public String SrcNodeNumber = "";
    public String SrcPhysics_NodeNumber = "";
    public String NodeNumber = "";
    public String Physics_NodeNumber = "";
    public int Result;
    public int Flag;
    public int CmdIDFlag;
    public String Keep2 = "";
    public String Keep3 = "";
    public byte[] MsgContent;

    public MsgHeader(int SessionID, int TranceID, int ModuleID, int CmdID, String SrcNodeNumber, String SrcPhysics_NodeNumber,
	    String NodeNumber, String Physics_NodeNumber, int Result, int Flag, int CmdIDFlag, String Keep2,
	    String Keep3, byte[] MsgContent) {
	this.SessionID = SessionID;
	this.TranceID = TranceID;
	this.ModuleID = ModuleID;
	this.CmdID = CmdID;
	this.SrcNodeNumber = SrcNodeNumber;
	this.SrcPhysics_NodeNumber = SrcPhysics_NodeNumber;
	this.NodeNumber = NodeNumber;
	this.Physics_NodeNumber = Physics_NodeNumber;
	this.Result = Result;
	this.Flag = Flag;
	this.CmdIDFlag = CmdIDFlag;
	this.Keep2 = Keep2;
	this.Keep3 = Keep3;
	this.MsgContent = MsgContent;
    }

    /**
     * 从当前通用对象获取probuf对象
     * 
     * @return
     */
    public Message dataChangeCommonToProBufData() {
	try {
	    com.proto.uuos_sdk_pb.MsgHeader.Builder builder_dst = com.proto.uuos_sdk_pb.MsgHeader.newBuilder();
	    builder_dst.setSessionID(SessionID);
	    builder_dst.setTranceID(TranceID);
	    builder_dst.setModuleID(ModuleID);
	    builder_dst.setCmdID(CmdID);
	    builder_dst.setSrcNodeNumber(SrcNodeNumber);
	    builder_dst.setSrcPhysicsNodeNumber(SrcPhysics_NodeNumber);
	    builder_dst.setNodeNumber(NodeNumber);
	    builder_dst.setSrcPhysicsNodeNumber(SrcPhysics_NodeNumber);
	    builder_dst.setPhysicsNodeNumber(Physics_NodeNumber);
	    builder_dst.setResult(Result);
	    builder_dst.setFlag(Flag);
	    builder_dst.setCmdIDFlag(CmdIDFlag);
	    builder_dst.setKeep2(Keep2);
	    builder_dst.setKeep3(Keep3);
	    Message pbMessage = builder_dst.build();
	    return pbMessage;
	} catch (Exception e) {
	    e.printStackTrace();
	}
	return null;
    }

    /**
     * 从probuf对象获取当前对象
     * 
     * @param builder_src
     * @return
     */
    public void dataChangeProBufDataToCommon(Message builder_src) {
	try {
	    com.proto.uuos_sdk_pb.MsgHeader builder_dst = (com.proto.uuos_sdk_pb.MsgHeader) builder_src;

	    SessionID = builder_dst.getSessionID();
	    TranceID = builder_dst.getTranceID();
	    ModuleID = builder_dst.getModuleID();
	    CmdID = builder_dst.getCmdID();
	    SrcNodeNumber = builder_dst.getSrcNodeNumber();
	    SrcPhysics_NodeNumber = builder_dst.getSrcPhysicsNodeNumber();
	    NodeNumber = builder_dst.getNodeNumber();
	    SrcPhysics_NodeNumber = builder_dst.getSrcPhysicsNodeNumber();
	    Physics_NodeNumber = builder_dst.getPhysicsNodeNumber();
	    Result = builder_dst.getResult();
	    Flag = builder_dst.getFlag();
	    CmdIDFlag = builder_dst.getCmdIDFlag();
	    Keep2 = builder_dst.getKeep2();
	    Keep3 = builder_dst.getKeep3();

	    MsgContent = builder_dst.getMsgContent().toByteArray();
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }
}
